package com.lagou.order;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;


public class OrderMapper extends Mapper<LongWritable, Text,OrderBean, NullWritable> {


    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
//      将读取的文本数据保存到bean对象中
        OrderBean bean = new OrderBean();
//        默认将id设置为1，防止传输时报空指针错误
        bean.setId(1);
        bean.setNumber(Integer.parseInt(value.toString()));
        context.write(bean,NullWritable.get());

    }
}


